
 <!DOCTYPE html>
<html>
  <head>
    <META charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

    <style>
    </style>
      <script>document.write('<script src="../../plugin/vue/js/import.js?' + Math.random() + '"><' + '/script>');</script>

      <script>
		_import("../../plugin/vue/js/jquery.min.js");
	</script>
	<script>
		_import("../../plugin/vue/js/tools.js");
	</script>
	<script>
		_import("../../plugin/vue/js/config.js");
	</script>
	<script>
		_import("../../plugin/vue/js/vxe-table/vxe-table.css");
	</script>
	
  </head>
  <body>

    <div id="app">       
        <vxe-table
          ref="xTable"
          border
          highlight-hover-row
          highlight-current-row
          resizable
          :tree-config="{lazy:true, children: 'children', hasChild:'hasChild', loadMethod: getChidrenList }"  
          :data="tableData">
          <vxe-table-column field="name" :title="`${name}`" tree-node></vxe-table-column>
          <vxe-table-column field="size" :title="size"></vxe-table-column>
          <vxe-table-column field="type" :title="type"></vxe-table-column>
          <vxe-table-column field="updateTime" title="Date"></vxe-table-column> 
        </vxe-table>
    </div>
    <script>
		_import("../../plugin/vue/js/vue.min.js");
	</script>
	<script>
		_import("../../plugin/vue/js/vxe-table/xe-utils.min.js");
	</script>
	<script>
		_import("../../plugin/vue/js/vxe-table/vxe-table.min.js");
	</script>
    <script>
      
    </script>
    <script>
      var vueApp = new Vue({
        el: '#app',
        data: function(){
          return {
        	name:"文件名",
        	size:"文件大小",
        	type:"文件类型",
            tableData: [
            ]
          }
        },
        mounted: function(){
          this.getRootList(null);
        },  
        methods:{
          getRootList: function() {
            var data = tools.ajaxRequestEx("pub/attach/nodelist",{});
            this.tableData.push(...data.list);
          },
          getChidrenList:function(row){
        	  var that=this;
            // console.log(row)
            var jsonStr = {"id": row.row.id};
        		var reqData = {
        			"jsonStr":JSON.stringify(jsonStr)	
        		};
            //var data = tools.ajaxRequestEx("pub/attach/nodelist",reqData);
            //return Promise.resolve(data.list);     
            
       		 return new Promise(function(rs, rj){
       		      	tools.ajaxRequestAsyncEx("pub/attach/nodelist",reqData, function(data){
       		            if (data.respCode== "0") {
       		              rs(data.list);
       		            } else {  
       		            	//rj('error');     		         
       		               rj("fail");
       		            }
       		        });  
       		  }).then(null,function(err){
       			  console.log(err);
       		  });      
            
            
          },
         
 
        }
      })  
      
    </script>
  </body>  
</html>
